package com.mylibraryapplication.utils;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

import com.mylibraryapplication.activity.GuideActivity;
import com.mylibraryapplication.http.RxSubscribe;

/**
 * @author yinsujun  Created at 2016/9/8 11:34
 */
public abstract class RxTest<T> extends RxSubscribe<T> {
    private Context context;

    public RxTest(Context context, String msg) {
        super(context, msg);
        this.context=context;
    }
    public RxTest(Context context) {
        super(context);
        this.context=context;
    }

    @Override
    protected void _onNext(T t ) {
        onSuccess(t);
    }
    @Override
    protected void _onError(String message, int code) {
        onFail(message);
        Log.e("请求失败信息",code+"===="+message);
//        if(code==401){
//            context.startActivity(new Intent(context, GuideActivity.class));
//        }else{
//            onFail(message);
//        }
    }

    public abstract void onSuccess(T t);
    public abstract void onFail(String message);


}
